package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.github.pagehelper.PageInfo;
import com.rm.zeyou.entity.User;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.SalesmanService;
import com.rm.zeyou.util.login.LoginUtil;
import com.rm.zeyou.vo.request.SelectSalesmanChannelOrderDetailVo;
import com.rm.zeyou.vo.response.SalesmanIndexResponseVo;
import com.rm.zeyou.vo.response.SelectSalesmanChannelListResponseVo;
import com.rm.zeyou.vo.response.SelectSalesmanChannelOrderDetailResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 业务员表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:08
 */
@Api(tags = "业务员相关")
@RestController
@RequestMapping("/api/salesman")
public class SalesmanController {
    @Resource
    private SalesmanService salesmanService;
    @Resource
    private LoginUtil loginUtil;

    @ApiOperation(value = "业务员页面")
    @GetMapping("salesmanIndex")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<SalesmanIndexResponseVo> salesmanIndex() {
        User user = loginUtil.getUser();
        return salesmanService.salesmanIndex(user);
    }


    @ApiOperation(value = "业务员下渠道商订单明细")
    @PostMapping("selectSalesmanChannelOrderDetail")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<PageInfo<SelectSalesmanChannelOrderDetailResponseVo>> selectSalesmanChannelOrderDetail(@RequestBody SelectSalesmanChannelOrderDetailVo requestVo) {
        User user = loginUtil.getUser();
        return salesmanService.selectSalesmanChannelOrderDetail(user,requestVo);
    }


    @ApiOperation(value = "业务员下渠道商列表")
    @PostMapping("selectSalesmanChannelList")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<PageInfo<SelectSalesmanChannelListResponseVo>> selectSalesmanChannelList(@RequestBody SelectSalesmanChannelOrderDetailVo requestVo) {
        User user = loginUtil.getUser();
        return salesmanService.selectSalesmanChannelList(user,requestVo);
    }



}
